import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DoctorVO, DoctorForm, DoctorQuery } from '@/api/system/doctor/types';

/**
 * 查询医生列表
 * @param query
 * @returns {*}
 */

export const listDoctor = (query?: DoctorQuery): AxiosPromise<DoctorVO[]> => {
  return request({
    url: '/system/doctor/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询医生详细
 * @param id
 */
export const getDoctor = (id: string | number): AxiosPromise<DoctorVO> => {
  return request({
    url: '/system/doctor/' + id,
    method: 'get'
  });
};

/**
 * 新增医生
 * @param data
 */
export const addDoctor = (data: DoctorForm) => {
  return request({
    url: '/system/doctor',
    method: 'post',
    data: data
  });
};

/**
 * 修改医生
 * @param data
 */
export const updateDoctor = (data: DoctorForm) => {
  return request({
    url: '/system/doctor',
    method: 'put',
    data: data
  });
};

/**
 * 删除医生
 * @param id
 */
export const delDoctor = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/doctor/' + id,
    method: 'delete'
  });
};
